package com.sensePlusVR.adapter;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;

import com.sensePlusVR.utils.MyLog;

import java.util.List;

public class FollowDetailViewPagerAdapter extends PagerAdapter {
	private static final String TAG = FollowDetailViewPagerAdapter.class.getSimpleName();
	private List<View> list = null;

	public FollowDetailViewPagerAdapter(List<View> list) {
		this.list = list;
	}
	
	@Override
	public int getCount() {
		return list.size();
	}
	
	@Override
	public int getItemPosition(Object object) {
		MyLog.d(TAG, "getItemPosition object : " + ((View)object).toString());
		return PagerAdapter.POSITION_NONE;
	}
	
	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		((ViewPager)container).addView(list.get(position));
		MyLog.d(TAG, "instantiateItem position : " + position);
		return list.get(position);
	}
	
	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		MyLog.d(TAG, "destroyItem position : " + position);
		((ViewPager)container).removeView((View)object);
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}
}
